﻿using System;
using AccessControl.Contracts.Models;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Net;

namespace AccessControl.Data.Models
{
	/// <summary>
	/// Represents entry in the system
	/// </summary>
	/// <remarks></remarks>
	public class Entry : IpDevice, IEntry
	{
		#region Fields

		string _Name;
		EntryState _State;
		ObservableCollection<ICamera> _Cameras = new ObservableCollection<ICamera>();
		ObservableCollection<ISensor> _Sensors = new ObservableCollection<ISensor>();
		ObservableCollection<IEvent> _Events = new ObservableCollection<IEvent>();

		#endregion

		#region Public Properties

		/// <summary>
		/// Gets or sets the name.
		/// </summary>
		/// <value>
		/// The name.
		/// </value>
		public string Name
		{
			get { return _Name; }
			set
			{
				if (_Name != value)
				{
					_Name = value;
					NotifyPropertyChanged("Name");
				}
			}
		}

		/// <summary>
		/// Gets or sets the state.
		/// </summary>
		/// <value>
		/// The state.
		/// </value>
		public EntryState State
		{
			get { return _State; }
			set
			{
				if (_State != value)
				{
					_State = value;
					NotifyPropertyChanged("State");
				}
			}
		}

		/// <summary>
		/// Gets the sensors.
		/// </summary>
		public IList<ISensor> Sensors
		{
			get { return _Sensors; }
		}

		/// <summary>
		/// Gets the cameras.
		/// </summary>
		public IList<ICamera> Cameras
		{
			get { return _Cameras; }
		}

		/// <summary>
		/// Gets the events.
		/// </summary>
		public IList<IEvent> Events
		{
			get { return _Events; }
		}

		#endregion
	}
}
